import type { TableColumn } from '@/components/core/dynamic-table';
import { router } from '@/router';

export type TableListItem = API.SiteXfjdjlListPageResultItem;
export type TableColumnItem = TableColumn<TableListItem>;

const caseTaskStatus = (val) => {
  switch (val) {
    case 1:
      return '未开始';
    case 2:
      return '进行中';
    case 4:
      return '待处理';
    case 5:
      return '已结束';
    case 6:
      return '待回证';
    default:
      return '-';
  }
};

const caseCheckResult = (val) => {
  switch (val) {
    case 1:
      return '合格';
    case 2:
      return '不合格';
    default:
      return '-';
  }
};

// const casePunishType = (val) => {
//   switch (val) {
//     case 0:
//       return '简易程序';
//     case 1:
//       return '一般程序';
//     default:
//       return '-';
//   }
// };

export const xfjdjcCoumns: TableColumnItem[] = [
  {
    title: '任务编号',
    width: 60,
    dataIndex: 'taskNo',
    hideInSearch: true,
  },
  {
    title: '创建日期',
    dataIndex: 'createTime',
    width: 60,
    hideInSearch: true,
  },
  {
    title: '任务状态',
    width: 60,
    dataIndex: 'taskStatus',
    hideInSearch: true,
    customRender: ({ record }) => caseTaskStatus(record.taskStatus),
  },
  {
    title: '检查结果',
    width: 60,
    dataIndex: 'checkResult',
    hideInSearch: true,
    customRender: ({ record }) => caseCheckResult(record.checkResult),
  },
  // {
  //   title: '处理方式',
  //   width: 60,
  //   dataIndex: 'punishType',
  //   hideInSearch: true,
  //   customRender: ({ record }) => casePunishType(record.punishType),
  // },
  {
    title: '操作',
    width: 80,
    dataIndex: 'ACTION',
    align: 'center',
    fixed: 'right',
    actions: ({ record }) => [
      {
        label: '详情',
        onClick: () =>
          router.push({
            name: 'supervision-task-view',
            query: { id: record.id },
          }),
      },
    ],
  },
];
